//package com.example.publishDemo.Controller.SystemMessage;
//
//import com.example.publishDemo.Model.MessageInfo;
//import org.springframework.amqp.core.AmqpTemplate;
//import org.springframework.data.redis.connection.stream.RecordId;
//import org.springframework.data.redis.core.RedisTemplate;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.Resource;
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
//@Component
//public class SystemMessageProducer {
//
//    @Resource
//    AmqpTemplate amqpTemplate;
//
//    @Resource
//    RedisTemplate redisTemplate;
//
//    public void sendSystemMessage(String RoutingKey, MessageInfo Message){
//        amqpTemplate.convertAndSend("systemTopicExchange",RoutingKey,Message);
//
//        Map<Integer, Object> map = new HashMap<>();
//        map.put(Message.getM_id() , Message);
//        RecordId systemMessage = redisTemplate.opsForStream().add("SystemMessage", map);
//        redisTemplate.opsForStream().createGroup(systemMessage, "SystemMessageGroup");
//        System.out.println("System Message sent:"+Message);
//    }
//
//}
